//
//  File.c
//  Chart
//
//  Created by wu jingxing on 12-7-14.
//  Copyright (c) 2012年 GuangZhouXuanWu. All rights reserved.
//

#import "Geometry.h"

@implementation CGRectEx

@synthesize m_rect;

+(CGRectEx*)InitWithRect:(CGRect)rect
{
    CGRectEx* rectex=[[[CGRectEx alloc]init]autorelease];
    rectex.m_rect=rect;
    return rectex;
}

+(CGRectEx*)InitWithRect:(CGFloat)nX Y:(CGFloat)nY Width:(CGFloat)nWidth Height:(CGFloat)nHeigh
{
    CGRectEx* rectex=[[[CGRectEx alloc]init]autorelease];
    rectex.m_rect=CGRectMake(nX,nY,nWidth,nHeigh);
    return rectex; 
}

-(void)setM_nL:(CGFloat)nL
{
    m_rect.origin.x=nL;
}

-(CGFloat)m_nL
{
    return CGRectGetMinX(m_rect);
}

-(void)setM_nT:(CGFloat)nT
{
    m_rect.origin.y=nT;
}

-(CGFloat)m_nT
{
    return CGRectGetMinY(m_rect);
}

-(void)setM_nR:(CGFloat)nR
{
    m_rect.size.width=nR-CGRectGetMinX(m_rect);
}

-(CGFloat)m_nR
{
    return CGRectGetMaxX(m_rect);
}

-(void)setM_nB:(CGFloat)nB
{
    m_rect.size.height=nB-CGRectGetMinY(m_rect);
}

-(CGFloat)m_nB
{
    return CGRectGetMaxY(m_rect);
}

-(void)setM_nWidth:(CGFloat)nWidth
{
    m_rect.size.width=nWidth;
}

-(CGFloat)m_nWidth
{
    return CGRectGetWidth(m_rect);
}

-(void)setM_nHeight:(CGFloat)nHeight
{
    m_rect.size.height=nHeight;
}

-(CGFloat)m_nHeight
{
    return CGRectGetHeight(m_rect);
}

-(CGPoint)m_centerpoint
{
    return CGPointMake(self.m_nL+self.m_nWidth/2,self.m_nT+self.m_nHeight/2);
}

-(void)dealloc
{
    [super dealloc];
}

@end
